package com.jy.adscm.zltx.controller;


import com.jy.adscm.exception.AdscmSystemException;
import com.jy.adscm.support.SimpleCoreResponse;
import com.jy.adscm.zltx.bean.SjFileVersionRecord;
import com.jy.adscm.zltx.service.SjFileVersionRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zyl
 * @since 2018-11-08
 */
@RestController
@RequestMapping("/adscm/zltx/sjFileVersionRecord")
public class SjFileVersionRecordController {
    @Autowired
    SjFileVersionRecordService sjFileVersionRecordService;
      @RequestMapping("update")
    public SimpleCoreResponse update(@RequestBody SjFileVersionRecord sjFileVersionRecord, HttpServletRequest request)throws AdscmSystemException {
          boolean b = sjFileVersionRecordService.updateById(sjFileVersionRecord);
          return new SimpleCoreResponse("200","修改成功",b);
    }
    @RequestMapping("selectByFileId/{fileId}")
    public  SimpleCoreResponse selectByFileId(@PathVariable Integer fileId)throws AdscmSystemException{
        List<SjFileVersionRecord> sjFileVersionRecords = sjFileVersionRecordService.selectByFileId(fileId);
        return new SimpleCoreResponse("200","查询成功",sjFileVersionRecords);
    }
}

